package microassembler;

class microasm
{

    microasm()
    {
    }

    public static void main(String args[])
    {
        if(args.length != 2)
        {
            printUsage();
            return;
        }
        symbolTable symboltable = new symbolTable(args[0]);
        System.out.println(globals.ENDL + "Pass #1: microasm " + args[0] + " " + args[1] + globals.ENDL + "\tWarnings: " + symboltable.getWarningCount() + globals.ENDL + "\tErrors:   " + symboltable.getErrorCount() + globals.ENDL);
        if(symboltable.getErrorCount() == 0)
        {
            assembler assembler1 = new assembler(args[0], args[1], symboltable);
            System.out.println(globals.ENDL + "Pass #2: microasm " + args[0] + " " + args[1] + globals.ENDL + "\tWarnings: " + assembler1.getWarningCount() + globals.ENDL + "\tErrors:   " + assembler1.getErrorCount() + globals.ENDL);
        }
    }

    private static void printUsage()
    {
        System.out.println(globals.ENDL + "Usage: java microasm <input file> <output file>" + globals.ENDL);
        System.out.println("input file: Contains a micro-program with symbolic branch addresses.");
        System.out.println("output file: Contains the same micro-program with all symbolic" + globals.ENDL + "             addresses translated to their actual addresses." + globals.ENDL + "             This file is suitable for feeding to the virtual" + globals.ENDL + "             machine simulator." + globals.ENDL);
    }
}
